package com.yanqu.road.logic.bussiness.player;

import com.yanqu.road.entity.player.UserBeautyVoice;
import com.yanqu.road.logic.bussiness.DaoHelper;
import com.yanqu.road.entity.player.UserBeautyData;
import com.yanqu.road.entity.player.UserBeauty;
import com.yanqu.road.entity.player.UserBeautySkill;

import java.util.List;
import java.util.Map;

public class UserBeautyBussiness {
    public static UserBeauty getUserBeauty(long userId,int beautyId) {
        return DaoHelper.getUserBeautyDaoImpl().getUserBeauty(userId,beautyId);
    }

    public static Map<Integer, UserBeauty> getUserBeautyMap(long userId) {
        return DaoHelper.getUserBeautyDaoImpl().getUserBeautyMap(userId);
    }

    public static Map<Long, Map<Integer, UserBeauty>> getUserBeautyMap(List<Long> userIdList) {
        return DaoHelper.getUserBeautyDaoImpl().getUserBeautyMap(userIdList);
    }

    public static boolean addUserBeauty(UserBeauty userBeauty) {
        return DaoHelper.getUserBeautyDaoImpl().add(userBeauty);
    }

    public static boolean updateUserBeauty(UserBeauty userBeauty) {
        return DaoHelper.getUserBeautyDaoImpl().update(userBeauty);
    }

    public static Map<Integer, Map<Integer, UserBeautySkill>> getUserBeautySkillMap(long userId) {
        return DaoHelper.getUserBeautySkillDaoImpl().getUserBeautySkillMap(userId);
    }

    public static boolean addUserBeautySkill(UserBeautySkill userBeautySkill) {
        return DaoHelper.getUserBeautySkillDaoImpl().add(userBeautySkill);
    }

    public static boolean updateUserBeautySkill(UserBeautySkill userBeautySkill) {
        return DaoHelper.getUserBeautySkillDaoImpl().update(userBeautySkill);
    }

    public static Map<Integer, UserBeauty> getUserBeautyAndSkillMap(long userId) {
        Map<Integer, UserBeauty> userBeautyMap = getUserBeautyMap(userId);
        Map<Integer, Map<Integer, UserBeautySkill>> skillMap = getUserBeautySkillMap(userId);
        //装备技能信息
        for (Map.Entry<Integer, Map<Integer, UserBeautySkill>> skillEntry : skillMap.entrySet()) {
            if (userBeautyMap.containsKey(skillEntry.getKey())) {
                userBeautyMap.get(skillEntry.getKey()).setSkillMap(skillEntry.getValue());
            }
        }
        return userBeautyMap;
    }

    public static UserBeautyData getUserBeautyData(long userId) {
        return DaoHelper.getUserBeautyDataDaoImpl().getUserBeautyData(userId);
    }

    public static boolean addUserBeautyData(UserBeautyData userBeautyData) {
        return DaoHelper.getUserBeautyDataDaoImpl().add(userBeautyData);
    }

    public static boolean updateUserBeautyData(UserBeautyData userBeautyData) {
        return DaoHelper.getUserBeautyDataDaoImpl().update(userBeautyData);
    }

    public static Map<Integer, UserBeautyVoice> getUserBeautyVoiceMap(long userId){
        return DaoHelper.getUserBeautyVoiceDaoImpl().getUserBeautyVoiceMap(userId);
    }

    public static boolean addUserBeautyVoice(UserBeautyVoice userBeautyVoice){
        return DaoHelper.getUserBeautyVoiceDaoImpl().add(userBeautyVoice);
    }

    public static boolean updateUserBeautyVoice(UserBeautyVoice userBeautyVoice){
        return DaoHelper.getUserBeautyVoiceDaoImpl().update(userBeautyVoice);
    }
}
